import {myRequest,SYSMODULE} from '@/utils/api.js'

//根据模块获得菜单的权限
export function getMenu() {

	let menus=[];
	let module=SYSMODULE;
	
	console.log('getMenu()');
	
	//判断模块中是否包括当前模块
	//包括Ecrm
	if(module.indexOf('crm')!=-1){
		console.log('crm');
		menus=menus.concat(crmMenu);
	}
	
	//包括ERP
	if(module.indexOf('erp')!=-1){
		console.log('erp');
		menus=menus.concat(erpMenu);
	}
	
	//包括workorder
	if(module.indexOf('workorder')!=-1){
		console.log('workorder');
		menus=menus.concat(workorder);
	}
	return menus;
}

//CRM显示菜单
let crmMenu = [
	{
		name: '客户管理',
		child: [{
				name: '公共线索',
				icon: '../../static/crm/threadChi.png',
				url: '/pages/crm/cst_clue/show_public',
				menu_id: 'CstClue/show_public'
			},
			{
				name: '线索',
				icon: '../../static/crm/thread.png',
				url: '/pages/crm/cst_clue/show',
				menu_id: 'CstClue/show'
			},
			{
				name: '公海客户',
				icon: '../../static/crm/gonghaichi.png',
				url: '/pages/crm/cst_customer/show_public',
				menu_id: 'CstCustomer/show_public'
			},
			{
				name: '客户',
				img: '../../static/crm/kehu1.png',
				url: '/pages/crm/cst_customer/show',
				menu_id: 'CstCustomer/show'
			},
			{
				name: '联系人',
				img: '../../static/crm/lianxiren1.png',
				url: '/pages/crm/cst_linkman/show',
				menu_id: 'CstLinkman/show'
			},
			{
				name: '跟进记录',
				img: '../../static/crm/genjin1.png',
				url: '/pages/crm/cst_trace/show',
				menu_id: 'CstTrace/show'
			},			
			{
				name: '商机',
				img: '../../static/crm/shangji.png',
				url: '/pages/crm/cst_chance/show',
				menu_id: 'CstChance/show'
			},
			{
				name: '报价单',
				img: '../../static/crm/baojiadan.png',
				url: '/pages/crm/cst_quoted/show',
				menu_id: 'CstQuoted/show'
			},
			{
				name: '销售合同',
				img: '../../static/crm/hetong.png',
				url: '/pages/crm/sal_contract/show',
				menu_id: 'SalContract/show'
			},
			{
				name: '回款',
				img: '../../static/crm/shoukuandan2.png',
				url: '/pages/crm/fin_rece_record/show',
				menu_id: 'FinReceRecord/show'
			},
			{
				name: '开票',
				img: '../../static/crm/kaipiao.png',
				url: '/pages/crm/fin_invoice_pay/show',
				menu_id: 'FinInvoicePay/show'
			},
			{
				name: '其它收入',
				img: '../../static/crm/income1.png',
				url: '/pages/crm/fin_income_record/show',
				menu_id: 'FinIncomeRecord/show'
			},
			{
				name: '其它支出',
				img: '../../static/crm/expenses1.png',
				url: '/pages/crm/fin_expenses_record/show',
				menu_id: 'FinExpensesRecord/show'
			},
		]
	},
]

//erp菜单
let erpMenu = [
	{
		name: '客户管理',
		child: [
			// {name: '线索池',icon: '../../static/crm/threadChi.png',url: '/pages/crm/cst_clue/show_public',menu_id: 'CstClue/show_public'},
			// {name: '线索',icon: '../../static/crm/thread.png',url: '/pages/crm/cst_clue/show',	menu_id: 'CstClue/show'	},
			{
				name: '客户池',
				icon: '../../static/crm/gonghaichi.png',
				url: '/pages/crm/cst_customer/show_public',
				menu_id: 'CstCustomer/show_public'
			},
			{
				name: '客户',
				img: '../../static/crm/kehu1.png',
				url: '/pages/crm/cst_customer/show',
				menu_id: 'CstCustomer/show'
			},
			{
				name: '联系人',
				img: '../../static/crm/lianxiren1.png',
				url: '/pages/crm/cst_linkman/show',
				menu_id: 'CstLinkman/show'
			},
			{
				name: '跟进记录',
				img: '../../static/crm/genjin.png',
				url: '/pages/crm/cst_trace/show',
				menu_id: 'CstTrace/show'
			},
			{
				name: '商机',
				img: '../../static/crm/shangji.png',
				url: '/pages/crm/cst_chance/show',
				menu_id: 'CstChance/show'
			},
			{
				name: '报价单',
				img: '../../static/crm/baojiadan.png',
				url: '/pages/crm/cst_quoted/show',
				menu_id: 'CstQuoted/show'
			},
			{
				name: '销售合同',
				img: '../../static/crm/hetong.png',
				url: '/pages/crm/sal_contract/show',
				menu_id: 'SalContract/show'
			},
			{
				name: '销售订单',
				img: '../../static/crm/hetong.png',
				url: '/pages/crm/sal_order/show',
				menu_id: 'SalOrder/show'
			},
		]
	},
	{
		name: '采购管理',
		child: [
			{
				name: '供应商',
				img: '../../static/crm/kehu.png',
				url: '/pages/crm/sup_supplier/show',
				menu_id: 'SupSupplier/show'
			},
			{
				name: '采购合同',
				img: '../../static/crm/fapiao1.png',
				url: '/pages/crm/pos_contract/show',
				menu_id: 'PosContract/show'
			},
		]
	},
	{
		name: '库存管理',
		child: [
			{
				name: '出库单',
				img: '../../static/crm/stockout.png',
				url: '/pages/crm/stock_out/show',
				menu_id: 'FinReceRecord/show'
			},
			{
				name: '入库单',
				img: '../../static/crm/stockinto.png',
				url: '/pages/crm/stock_into/show',
				menu_id: 'FinInvoicePay/show'
			},
			// {
			// 	name: '盘点单',
			// 	img: '../../static/crm/fukuandan_3.png',
			// 	url: '/pages/crm/fin_pay_record/show',
			// 	menu_id: 'FinPayRecord/show'
			// },
			// {
			// 	name: '调拨单',
			// 	img: '../../static/crm/kaipiaoe.png',
			// 	url: '/pages/crm/fin_invoice_rece/show',
			// 	menu_id: 'FinReceRece/show'
			// },
			// {
			// 	name: '组装单',
			// 	img: '../../static/crm/income1.png',
			// 	url: '/pages/crm/fin_income_record/show',
			// 	menu_id: 'FinIncomeRecord/show'
			// },
			{
				name: '仓库',
				img: '../../static/crm/stockstore.png',
				url: '/pages/crm/stock_store/show',
				menu_id: 'FinExpensesRecord/show'
			},
		]
	},
	{
		name: '财务管理',
		child: [
			{
				name: '收款',
				img: '../../static/crm/shoukuandan2.png',
				url: '/pages/crm/fin_rece_record/show',
				menu_id: 'FinReceRecord/show'
			},
			{
				name: '开票',
				img: '../../static/crm/kaipiao.png',
				url: '/pages/crm/fin_invoice_pay/show',
				menu_id: 'FinInvoicePay/show'
			},
			{
				name: '付款',
				img: '../../static/crm/fukuandan_3.png',
				url: '/pages/crm/fin_pay_record/show',
				menu_id: 'FinPayRecord/show'
			},
			{
				name: '收票',
				img: '../../static/crm/kaipiaoe.png',
				url: '/pages/crm/fin_invoice_rece/show',
				menu_id: 'FinReceRece/show'
			},
			{
				name: '其它收入',
				img: '../../static/crm/income1.png',
				url: '/pages/crm/fin_income_record/show',
				menu_id: 'FinIncomeRecord/show'
			},
			{
				name: '其它支出',
				img: '../../static/crm/expenses1.png',
				url: '/pages/crm/fin_expenses_record/show',
				menu_id: 'FinExpensesRecord/show'
			},
		]
	},
	// {
	// 	name: '产品管理',
	// 	child: [
	// 		{ name: '商城预览', img: '../../static/crm/shopIcon.png', url: '../../chanpin/view/shop' },
	// 		{ name: '产品管理', img: '../../static/crm/chanpin.png', url: '../../chanpin/view/chanpin', menu_id: 'pList' },
	// 		{ name: '产品分类', img: '../../static/crm/cpfl.png', url: '../../chanpin/view/classify', menu_id: 'pClassify' }
	// 	]
	// },
]

//CRM显示菜单
let workorder = [{
		name: '工单管理',
		arr: [
			
			{
				name: '我的工单',
				icon: '../../static/crm/thread.png',
				url: '/pages/workorder/oa_service/show_my',
				menu_id: 'CstClue/show'
			},
			{
				name: '全部工单',
				icon: '../../static/crm/gonghaichi.png',
				url: '/pages/workorder/oa_service/show',
				menu_id: 'OaService/show'
			},
		]
	},
]
